from colorama import init, Fore, Back, Style

init()  # 初始化（Windows 推荐）

print(Fore.RED + '这是红色文字')
print(Back.GREEN + '这是绿色背景')
print(Style.BRIGHT + '这是加粗高亮')
print(Style.RESET_ALL + '恢复默认样式')

def log(level, msg):
    if level == "INFO":
        print(Fore.GREEN + "[INFO] " + Style.RESET_ALL + msg)
    elif level == "WARN":
        print(Fore.YELLOW + "[WARN] " + Style.RESET_ALL + msg)
    elif level == "ERROR":
        print(Fore.RED + "[ERROR] " + Style.RESET_ALL + msg)

log("INFO", "数据加载完成")
log("WARN", "磁盘空间不足")
log("ERROR", "数据库连接失败")